From: Aaron Schulz Date: Tue, 17 Dec 2013 07:09:21 +0000 (-0800) Subject: Moved ScopedCallback to /libs X-Git-Tag: 1.31.0-rc.0~17501^2 X-Git-Url: http://git.cyclocoop.org/%28%5B%5E/404?a=commitdiff_plain;h=22af3c78c66bb80a95be3a07d712a90de349dfb0;p=lhc%2Fweb%2Fwiklou.git Moved ScopedCallback to /libs * The MWException is now a standard PHP exception type Change-Id: I59e3b435cee32efe84c67766e29976b126384389 --- diff --git a/includes/AutoLoader.php b/includes/AutoLoader.php index 58c8461368..018e150c99 100644 --- a/includes/AutoLoader.php +++ b/includes/AutoLoader.php @@ -686,6 +686,7 @@ $wgAutoloadLocalClasses = array( 'JSParser' => 'includes/libs/jsminplus.php', 'JSToken' => 'includes/libs/jsminplus.php', 'JSTokenizer' => 'includes/libs/jsminplus.php', + 'ScopedCallback' => 'includes/libs/ScopedCallback.php', 'ScopedPHPTimeout' => 'includes/libs/ScopedPHPTimeout.php', 'XmlTypeCheck' => 'includes/libs/XmlTypeCheck.php', @@ -1073,7 +1074,6 @@ $wgAutoloadLocalClasses = array( 'RegexlikeReplacer' => 'includes/utils/StringUtils.php', 'ReplacementArray' => 'includes/utils/StringUtils.php', 'Replacer' => 'includes/utils/StringUtils.php', - 'ScopedCallback' => 'includes/utils/ScopedCallback.php', 'StringUtils' => 'includes/utils/StringUtils.php', 'UIDGenerator' => 'includes/utils/UIDGenerator.php', 'ZipDirectoryReader' => 'includes/utils/ZipDirectoryReader.php', diff --git a/includes/libs/ScopedCallback.php b/includes/libs/ScopedCallback.php new file mode 100644 index 0000000000..631b6519fe --- /dev/null +++ b/includes/libs/ScopedCallback.php @@ -0,0 +1,73 @@ +callback = $callback; + } + + /** + * Trigger a scoped callback and destroy it. + * This is the same is just setting it to null. + * + * @param ScopedCallback $sc + */ + public static function consume( ScopedCallback &$sc = null ) { + $sc = null; + } + + /** + * Destroy a scoped callback without triggering it + * + * @param ScopedCallback $sc + */ + public static function cancel( ScopedCallback &$sc = null ) { + if ( $sc ) { + $sc->callback = null; + } + $sc = null; + } + + /** + * Trigger the callback when this leaves scope + */ + function __destruct() { + if ( $this->callback !== null ) { + call_user_func( $this->callback ); + } + } +} diff --git a/includes/utils/ScopedCallback.php b/includes/utils/ScopedCallback.php deleted file mode 100644 index ef22e0a30d..0000000000 --- a/includes/utils/ScopedCallback.php +++ /dev/null @@ -1,73 +0,0 @@ -callback = $callback; - } - - /** - * Trigger a scoped callback and destroy it. - * This is the same is just setting it to null. - * - * @param ScopedCallback $sc - */ - public static function consume( ScopedCallback &$sc = null ) { - $sc = null; - } - - /** - * Destroy a scoped callback without triggering it - * - * @param ScopedCallback $sc - */ - public static function cancel( ScopedCallback &$sc = null ) { - if ( $sc ) { - $sc->callback = null; - } - $sc = null; - } - - /** - * Trigger the callback when this leaves scope - */ - function __destruct() { - if ( $this->callback !== null ) { - call_user_func( $this->callback ); - } - } -}